/**
 * API模块索引
 * 统一导出所有API接口
 */

// 导入API模块
const request = require('./request');
const user = require('./user');
const medicalHistory = require('./medicalHistory');
const healthTarget = require('./healthTarget');
const riskAssessment = require('./riskAssessment');
const health = require('./health');
const diet = require('./diet');
const exercise = require('./exercise');

// 创建food API模块
const food = {
  getFoodGIList: () => request.get('/food/gi'),
  getFoodGIById: (id) => request.get(`/food/gi/${id}`),
  getFoodRecommendations: (params) => request.get('/food/recommend', params),
  searchFood: (params) => request.get('/food/search', params)
};

// 导入原始API以保持兼容性
const originalAPI = require('../api');

/**
 * 配置API
 * @param {Object} options - 配置项
 * @param {string} options.baseUrl - API基础URL
 * @param {number} options.timeout - 请求超时时间(毫秒)
 */
function configure(options) {
  request.configure(options);
}

// 导出
module.exports = {
  configure,
  request,
  user,
  medicalHistory,
  healthTarget,
  riskAssessment,
  health,
  diet,
  exercise,
  food,
  
  // 保持原有API兼容性
  // 注意：health已被新的API模块覆盖
  // 这里不再单独导出原始API中的health
}; 